ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
ADC.c File Reference

ADC drivers for MPC5604P. More...

#include "Compile_Options.h"
#include "derivative.h"
#include "ADC.h"
#include <limits.h>

Functions

uint8_t u8fnADCConvert (const uint8_t cu8ADCInstance, const uint8_t cu8ADCCh, uint16_t *pu16Result)
 Launches ADC to perform a conversion for a given channel.
uint8_t u8fnADCConfig (uint8_t u8Instance, ADCConfig_t *ptADCConfig)
 Configures a particular instance for operation according to passed argument.
uint8_t u8fnADCChannelConfig (const ADCChConfig_t *tADCChConfig, const uint16_t *pu16Results)
 Configures a particular channel for a programmed conversion.
uint8_t u8fnADCReadChannel (uint8_t u8Instance, uint8_t u8Channel, uint16_t *pu16ADCResult)
 Performs exactly what it names suggests.
uint8_t u8fnADCStatus (uint8_t u8Instance)
 Returns the HW status of an instance.
uint8_t u8fnADCNormalConversionEnable (uint8_t u8Instance, uint8_t u8Enable)
 Starts a normal (scheduled) conversion.
void vfnADC0EoCIsr (void)
 Channels an end of conversion isr from ADC0 into the general ADC end of conversion Isr with its proper argument.
void vfnADC1EoCIsr (void)
 Channels an end of conversion isr from ADC1 into the general ADC end of conversion Isr with its proper argument.
void vfnADC0ErrIsr (void)
 Channels a error isr from ADC0 into the general ADC error Isr with its proper argument.
void vfnADC1ErrIsr (void)
 Channels a error isr from ADC1 into the general ADC error Isr with its proper argument.
void vfnADC0WatchDogIsr (void)
 Channels a watchdog isr from ADC0 into the general ADC Watchdog Isr with its proper argument.
void vfnADC1WatchDogIsr (void)
 Channels a watchdog isr from ADC1 into the general ADC Watchdog Isr with its proper argument.

Variables

const ADC_t catADCInstanceList []
uint16_t * gpu16ADCResults [(ADC_NO_MODULES *(ADC_CH_MAX+1u))]
uint16_t gau16ADCChToRead [ADC_NO_MODULES]

Detailed Description

ADC drivers for MPC5604P.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Function Documentation

uint8_t u8fnADCChannelConfig ( const ADCChConfig_t tADCChConfig,
const uint16_t *  pu16Results 
)

Configures a particular channel for a programmed conversion.

Parameters:
tADCChConfig,:pointer to tADCChConfig with the correct instance and channel to configure
pu16Results,:Where to place the result once it's ready.
Returns:
Clear if no problems found; ADC_ERR_INVALID_CH if an invalid channel is referenced; ADC_ERR_ONGOING_CONV if there's an on-going request when triggered.
uint8_t u8fnADCConfig ( uint8_t  u8Instance,
ADCConfig_t ptADCConfig 
)

Configures a particular instance for operation according to passed argument.

Parameters:
u8Instance,:ADC instance to associate this fn to.
ptADCConfig,:Configuration settings as described by ADCConfig_t
Returns:
Clear if no problems found; ADC_ERR_BAD_INSTANCE if an non- existing instance is referenced.
uint8_t u8fnADCConvert ( const uint8_t  cu8ADCInstance,
const uint8_t  cu8ADCCh,
uint16_t *  pu16Result 
)

Launches ADC to perform a conversion for a given channel.

Parameters:
cu8ADCInstance,:ADC instance to associate this fn to.
cu8ADCCh,:ADC channel for that particular instance.
pu16Result,:10-bit result of the conversion.
Returns:
Clear if no problems found; ADC_ERR_BAD_INSTANCE if an non- existing instance is referenced; ADC_ERR_INVALID_CH if an invalid channel is referenced; ADC_ERR_ONGOING_CONV if there's an on-going request when triggered.
uint8_t u8fnADCNormalConversionEnable ( uint8_t  u8Instance,
uint8_t  u8Enable 
)

Starts a normal (scheduled) conversion.

Parameters:
u8InstanceWhich ADC instance is going to be read.
u8Enablezero for disable, non-zero for enable.
Returns:
Clear if no problems found; ADC_ERR_BAD_INSTANCE if an non- existing instance is referenced.
uint8_t u8fnADCReadChannel ( uint8_t  u8Instance,
uint8_t  u8Channel,
uint16_t *  pu16ADCResult 
)

Performs exactly what it names suggests.

Parameters:
u8Instance,:Which ADC instance is going to be read.
u8Channel,:Which channel is going to be read.
pu16ADCResultWhere the result will be placed.
Returns:
Clear if no problems found; ADC_ERR_INVALID_CH if an invalid channel is referenced; ADC_ERR_ONGOING_CONV if there's an on-going request when triggered.
uint8_t u8fnADCStatus ( uint8_t  u8Instance)

Returns the HW status of an instance.

Parameters:
u8Instance,:Which ADC instance is going to be read.
Returns:
ADCSTATUS as defined in the HW definition: ADC_ST_IDLE for IDLE; ADC_ST_POWER_DOWN for Power down; ADC_ST_WAIT for Wait; ADC_ST_SAMPLE for sampling; ADC_ST_CONVERSION for converting
void vfnADC0EoCIsr ( void  )

Channels an end of conversion isr from ADC0 into the general ADC end of conversion Isr with its proper argument.

Parameters:
None
Returns:
Void.
void vfnADC0ErrIsr ( void  )

Channels a error isr from ADC0 into the general ADC error Isr with its proper argument.

Parameters:
u8InstanceADC instance.
Returns:
Void.
void vfnADC0WatchDogIsr ( void  )

Channels a watchdog isr from ADC0 into the general ADC Watchdog Isr with its proper argument.

Parameters:
None
Returns:
Void.
void vfnADC1EoCIsr ( void  )

Channels an end of conversion isr from ADC1 into the general ADC end of conversion Isr with its proper argument.

Parameters:
None
Returns:
Void.
void vfnADC1ErrIsr ( void  )

Channels a error isr from ADC1 into the general ADC error Isr with its proper argument.

Parameters:
None
Returns:
Void.
void vfnADC1WatchDogIsr ( void  )

Channels a watchdog isr from ADC1 into the general ADC Watchdog Isr with its proper argument.

Parameters:
None
Returns:
Void.

Variable Documentation

Initial value:
 
{
  &ADC_0, &ADC_1
}

List of pointers to our ADC instances

uint16_t gau16ADCChToRead[ADC_NO_MODULES]

Mask of channels to be read by module

uint16_t* gpu16ADCResults[(ADC_NO_MODULES *(ADC_CH_MAX+1u))]

Container for read values (not in auto mode)